package com.software.loginregister.adapter;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.viewpager2.adapter.FragmentStateAdapter;

import com.software.loginregister.fragment.menudraftsfragment.PostDraftFragment;
import com.software.loginregister.fragment.menudraftsfragment.WorksDraftFragment;

public class DraftsAdapter extends FragmentStateAdapter {
    public DraftsAdapter(FragmentActivity fragmentActivity) {
        super(fragmentActivity);
    }

    @NonNull
    @Override
    public Fragment createFragment(int position) {
        // 根据位置返回对应的Fragment
        return position == 0 ? new WorksDraftFragment() : new PostDraftFragment();
    }

    @Override
    public int getItemCount() {
        return 2; // 总共两个标签页
    }
}